from mmdet.apis import init_detector, inference_detector, show_result
import mmcv
import torch
config_file = '../configs/anti-uav/ssd300_voc.py'
checkpoint_file = '../tools/work_dirs/ssd300_voc/latest.pth'

# build the model from a config file and a checkpoint file
model = init_detector(config_file, checkpoint_file)

# test a single image and show the results
img = '20190925_213001_1_2_00830.jpg'  # or img = mmcv.imread(img), which will only load it once

result = inference_detector(model, img)
show_result(img, result, model.CLASSES)